/**
 * 
 */
package com.oauth.global.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.oauth.components.client.ui.HasWidgetInfo;

/**
 * @author asanthan
 * 
 */
public class SubscribedApplication extends Composite {

	private static SubscribedApplicationUiBinder uiBinder = GWT
			.create(SubscribedApplicationUiBinder.class);

	interface SubscribedApplicationUiBinder extends UiBinder<Widget, SubscribedApplication> {
	}

	@UiField
	Button resignButton;

	@UiField
	Label appName;

	@UiField
	Image appIconImage;

	public SubscribedApplication(HasWidgetInfo widgetInfo) {
		initWidget(uiBinder.createAndBindUi(this));
		appName.setText(widgetInfo.getName());
		appIconImage.setUrl(widgetInfo.getIcon().getUrl());

		resignButton.addClickHandler(new SignInButtonClickHandler(widgetInfo.getId()));
	}

}
